<?php
/**
 * @author 		: Sergio Martínez
 * @copyright 	: 23-05-2012
 * @uses 		: Definición de comportamientos generales
 * @todo 		: modules | usuarios | behaviour
 * @version 	: 2.0
 */

	if ($glb_actionDontCome) {
		irAlListado("list");
	}

	if (isset($glb_action) && ($glb_action == "update" || $glb_action == "change_password")) {
		if (strlen($_GET["id"]) > 15) {
		$encodeUserId = $_GET["id"];
		$i = 0;
		while ($encodeUserId) {
			$i++;
			if (md5(sha1(md5($i))) == $encodeUserId) {
				$id = $i;
				$encodeUserId = false;
			}
		}
		$object->traerDatos($id);
		} else {
			if (isset($_GET["id"]) && intval($_GET["id"]) > 0) {
				$id = $_GET["id"];
				$object->traerDatos($id);
			} else irAlListado("list");
		}
	}
	if (isset($_POST["form-action"])) {
		autoload_itemsform();
		include ("modules/".$glb_section."/actions/".$glb_action."/controller.php");
		if ($glb_action != "change_password") irAlListado("list");
	}
?>